<?php
session_start();
if($_SESSION['login'] != true) {
	die('Access danied');
}
//------------------------------
define(MANAGE_PROXIES,		'manageProxies');
define(MANAGE_SEARCHERS,	'manageSearchers');
define(SHOW_RESULTS, 		'showResults');
define(ADVANCED_CONFIG,		'advancedConfig');
//------------------------------
include ('../dbPostgres.php');

$db	= new dbPostgres();
if(!$db->connect()) {
	die('Nie można połączyć się z bazą danych');
}
?>
<html>
<head>
	<meta name="author" content="Krzysztof Ulman" />
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
	<meta http-equiv="Content-Language" content="pl" />
	<script type="text/javascript" src="../scripts/jquery.js"></script> 
	<link rel="stylesheet" href="../style.css" type="text/css" media="screen" />
	<link rel="stylesheet" href="styleConfiguration.css" type="text/css" media="screen" />
	<?php
		if(IsSet($_GET['configType'])) {
			$configType = $_GET['configType'];
		} else {
			$configType = '';
		}
		
		if(IsSet($_GET['actionType'])) {
			$actionType = $_GET['actionType'];
		} else {
			$actionType = '';
		}
		
		$title = 'OmnibusProxy';
		if($configType == MANAGE_PROXIES) {
			$title .= ' - Zarządzanie serwerami proxy';
		} else if($configType == MANAGE_SEARCHERS) {
			$title .= ' - Zarządzanie wyszukiwarkami';
		} else if($configType == SHOW_RESULTS) {
			$title .= ' - Zarządzanie frazami i przeglądanie wyników';
		} else if($configType == ADVANCED_CONFIG) {
			$title .= ' - Konfiguracja zaawansowana';
		}
	?>
	<title><?php echo $title; ?></title>
</head>
<body>
<?php include('../developmentInfo.php'); ?>
<div style="width: 100%; height: 100%; text-align: center; vertical-align: middle">
	<br>
	<h2><?php echo $title; ?></h2>
	<br>
	<center>
		<div style="width: 700px; border: 1px solid black; padding: 20px 0px; overflow:visible;" align="center" valign="middle">
			<?php
				if($configType == MANAGE_PROXIES) {
					include('bodyManageProxies.php');
				} else if ($configType == MANAGE_SEARCHERS) {
					include('bodyManageSearchers.php');
				} else if($configType == SHOW_RESULTS) {
					include('bodyShowResults.php');
				} else if($configType == ADVANCED_CONFIG) { 
					include('bodyAdvancedConfig.php');
				} else {
					echo 'Niepoprawne wywołanie.';
				}
			?>
		</div>
		<br>
		<div style="font-size: 13px;">
			Copyright &copy; 2012 Krzysztof Ulman<br>
			<br>
			Praca dyplomowa magisterska.<br>
			Instytut Teleinformatyki, Politechnika Krakowska.
		</div>
	</center>
</div>
</body>
<?php
$db->disconnect();

/*
*	FUNKCJE
*/

function enableConfirm() {
	?>
	<div id="confirm"></div>
	<script type="text/javascript">
		$(document).ready(function(){
		$(".confirm").click(function(){
		$("#confirm")
		.css({opacity:0.95})
		.fadeIn()
		.html('<div><div><h1>Usunąć?</h1><p><button onClick=\"location.href=\'' + $($(this).parent()).attr("href") + '\'\"> TAK </button>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<button> NIE </button></p></div></div>');
		return false;
		});
		$("#confirm").click(function(){$(this).fadeOut();});
		});
	</script>
	<?php
}
?>